package com.example.film.controller;

import com.example.film.entity.EachYearSell;
import com.example.film.service.EachYearSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "历年电影内地票房排行信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("eachYear/v1")
public class EachYearSellController {
    @Autowired
    private EachYearSellService eachYearSellService;

    @ApiOperation("分页查询历年电影内地票房排行信息")
    @GetMapping("/yearSell")
    public List<EachYearSell> getEachYearSellInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return eachYearSellService.findEachYearSellInfo(pageNum, pageSize);
    }

    @ApiOperation("根据年份分页显示历年电影内地票房排行信息")
    @GetMapping("/year")
    public List<EachYearSell> getEachYearSellByYear(@RequestParam Integer year,@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return eachYearSellService.findEachYearSellByYear(year, pageNum, pageSize);
    }
}
